# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=trape
pkgver=132.6baae24
pkgrel=8
pkgdesc='People tracker on the Internet: OSINT analysis and research tool by Jose Pino.'
groups=('blackarch' 'blackarch-social' 'blackarch-recon')
arch=('any')
url='https://github.com/jofpin/trape'
license=('custom:unknown')
depends=('python' 'python-flask' 'python-flask-login' 'python-flask-cors'
         'python-flask-socketio' 'python-itsdangerous' 'python-jinja'
         'python-markupsafe' 'python-engineio' 'python-socketio' 'python-six'
         'python-werkzeug' 'python-eventlet' 'python-requests'
         'python-colorama')
makedepends=('git')
source=("git+https://github.com/jofpin/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i "s|c_ipinfo + '\",|c_ipinfo + '\"|" core/trape.py
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin/"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md requirements.txt version.txt

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

